<template>
  <div class="Whole">
    <div class="top">
      <span @click="returngo">✌</span>
      <span>砍价列表</span>
      <span> </span>
    </div>
    <div class="content">
      <ul>
        <li
          v-for="(item, index) in list"
          :key="index"
          @click="gotowholeshop(item.id)"
        >
          <div class="left-img">
            <img :src="item.pic" alt="" />
          </div>
          <div class="right-text">
            <span class="xi" v-html="item.name"></span>
            <span class="grows">{{ item.characteristic }}</span>
            <div class="price">
              <p>
                <span class="red">{{ "￥" + item.minPrice }}</span>
                <span>低价</span>
              </p>
              <p>
                <span class="grow">{{ "￥" + item.originalPrice }}</span>
                <span class="grow">原价</span>
              </p>
              <p>
                <span class="grow">{{ item.stores }}件</span>
                <span class="grow">限量</span>
              </p>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getWholeshop } from "../../utils/api";
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    getWholeshop().then((res) => {
      this.list = res.data.goodsMap;
      console.log(this.list);
    });
  },
  methods: {
    //去砍价商品的详情
    gotowholeshop(id) {
      this.$router.push({ path: "/wholedetail", query: { id } });
    },
    returngo() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.Whole {
  width: 100%;
  height: 12.3rem;
  border-bottom: 0.3rem solid #f5f5f5;
  .top {
    width: 100%;
    display: flex;
    justify-content: space-around;
    height: 1rem;
    line-height: 1rem;
    font-size: 0.37rem;
    border-bottom: 1px solid #cccccc;
  }
  li {
    display: flex;
    justify-content: space-around;
    padding-top: 0.2rem;
    border-bottom: 1px solid #cccccc;
    .left-img {
      width: 35%;
      height: 100%;
      img {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 0.1rem;
      }
    }
    .right-text {
      width: 50%;
      height: 100%;
      span {
        display: block;
      }
      .xi {
        font-size: 0.3rem;
      }
      .grows {
        color: #cccccc;
        font-size: 0.1rem;
      }
      .price {
        display: flex;
        justify-content: space-around;
        box-sizing: border-box;
        padding-top: 1rem;
        text-align: center;
        padding-right: 0.9rem;
        .red {
          color: red;
          font-weight: 700;
        }
        .grow {
          color: #cccccc;
        }
      }
    }
  }
}
</style>
